package com.lanchetech.dao;

import com.lanchetech.bean.request.TimeRangeReq;
import com.lanchetech.bean.vo.SpuStatisticsSumVO;
import com.lanchetech.bean.vo.StatisticsVO;
import com.lanchetech.bean.vo.TotalStatisticsVO;
import com.lanchetech.entity.SpuStatistics;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

@Mapper
public interface SpuStatisticsMapper {
    int deleteByPrimaryKey(Long id);

    int insert(SpuStatistics record);

    int insertSelective(SpuStatistics record);

    SpuStatistics selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(SpuStatistics record);

    int updateByPrimaryKey(SpuStatistics record);

    SpuStatistics findOneBySpuIdAndDateTime(@Param("spuId") Long spuId, @Param("dateTime") Date dateTime);

    Integer addUvAndPv(@Param("spuId") Long spuId, @Param("uv") Long uv);

    SpuStatisticsSumVO getSpuStatisticsByTime(@Param("spuId") Long spuId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    List<TotalStatisticsVO> getTotalPv(List<Long> list);

    SpuStatisticsSumVO sumPvAndUvByDateTimeAndTenantId(@Param("date") Date date, @Param("tenantId") Long tenantId);

    SpuStatisticsSumVO sumPvAndUvByDateAndTenantId(@Param("startTime") Date startTime, @Param("endTime") Date endTime,@Param("tenantId") Long tenantId);

    SpuStatisticsSumVO getShopStatisticsData(TimeRangeReq req);

    List<StatisticsVO> getSpuClickTrend(@Param("req") TimeRangeReq req, @Param("tenantId") Long tenantId);

    List<StatisticsVO> getSpuVisitorTrend(@Param("req") TimeRangeReq req, @Param("tenantId") Long tenantId);
}